<?php
/*
 * @TUDO 实例Action层
 * @AUTHOR zhouyang
 * @DATE 2013-7-18
 */
class Action
{
	private $action;

    //初始化
    public function __construct($action = '')
    {
		$this->action = $action ? $action : substr(get_class($this), 0, -6);
    }

    //实例化Action层
    static public function getInstance($action)
    {
        static $instances = array();

        if (! isset($instances[$action]))
        {
            if (file_exists(CURR_PROJECT_PATH . $action . '.php'))
            {
                include CURR_PROJECT_PATH . $action . '.php';
            }

            $classname = $action.'Action';

            $classname = ucwords($classname);
            $instances[$action] = new $classname($action);
        }
        return $instances[$action];
    }

    //实例化SESSION
    final public function session(){
        return Session::getInstance();
    }

    final public function input(){
        return Input::getInstance();
    }
}


?>